package com.dede.rxbase.util;

import android.app.Activity;
import android.app.Fragment;
import android.util.Log;

import com.dede.rxbase.config.BaseConfig;

/**
 * @author hsh
 *         2018/1/18 13:58.
 */
public final class BLog {

    private BLog() {
    }

    public static void log(Object obj, String msg) {
        if (!BaseConfig.getInstance().isDebug()) return;

        if (obj instanceof Activity) {
            Log.d("Activity", String.format("%s\n%s", obj.getClass().getSimpleName(), msg));
        } else if (obj instanceof Fragment) {
            Log.d("Fragment", String.format("%s\n%s", obj.getClass().getSimpleName(), msg));
        } else if (obj instanceof android.support.v4.app.Fragment) {
            Log.d("Fragment", String.format("%s\n%s", obj.getClass().getSimpleName(), msg));
        } else if (obj instanceof String) {
            Log.d((String) obj, msg);
        } else {
            Log.d(obj.getClass().getSimpleName(), msg);
        }
    }
}
